// 1.引入vue和vueroter的包
import Vue from 'vue'
import VueRouter from 'vue-router'
// 2.调用Vue.use()函数,把vuerouter安装为插件
Vue.use(VueRouter)
// 3.创建路由的实例对象
const router = new VueRouter({
  // 使用routes选项配置路由规则
  // 路由规则:hash地址和对应的插件
  routes:[
    {path:'/',redirect:'/home'},
    {path:'/home',component:()=>import('@/components/Home')},
    {path:'/movie',component:()=>import('@/components/Movie')},
    {
      path:'/about',
      redirect:'/about/tab1',
      component:()=>import('@/components/About'),
      children:[
        {
          path:'tab1',
          component:()=>import('@/components/tabs/Tab1.vue'),
          children:[
            {path:'/movie/:id',component:()=>import('@/components/Movie.vue')}
            
          ]
        },
        {path:'tab2',component:()=>import('@/components/tabs/Tab2.vue')}
      ]
    }
  ]
})
// 4.导出路由实例对象
export default router